Havish M Consulting
Customer Case Study · Finance · Receivables Reconciliation
Power Transmission (InvIT) × Havish M Consulting

1,000 PDFs in. One clean table out.

The transmission company received POWERGRID disbursement advices as more than a thousand PDF and Excel files, each slightly different. HMC built a Power Query process with custom functions that reads every one, cleans it and stacks it into a single table, and keeps working when the format changes.

ClientPower Transmission (InvIT) FunctionFinance · Receivables ThemePower Query Automation
Advice files consolidated
0+files
PDF and Excel, DA 3011 to 4001
Time to refresh the full dataset
0minutes
▼ from about 3 weeks of copy-paste
Custom functions handling variability
0functions
new formats handled without rework
Manual re-keying of figures
0rows
▼ every row traced to its source file

Figures indicative; validated metrics available on request.

The Challenge

Every receipt was in there, in a thousand different files

When a distribution company pays its transmission charges, POWERGRID issues a disbursement advice showing how the payment is split between licensees. To reconcile receipts for its transmission assets, the transmission company needed every advice in one table.

1,000+ files

The advices sat in batch folders from DA 3011 to DA 4001. Opening each file and copying its rows would take weeks.

Unstructured data

Headers wrapped across lines, page footers and total rows sat inside tables, and numbers mixed Indian and Western commas.

The format kept changing

Later batches arrived as Excel instead of PDF, with title rows, serial dates and renamed licensees. Any fixed template would break.

Reconciliation needs every row

Billing, disbursement ratio, rebate, TDS and net disbursement all had to tie out, file by file, payer by payer.

HMC Approach

Teach Power Query to read an advice, then point it at the folder

Built with the transmission company's finance team, in the Excel workbook they already used for reconciliation.

Select a step to see what happened.

Discover · Catalogue the mess

We sampled advices from every batch folder and listed every way they differed.

  • Two tables per advice: payment header and licensee-wise details.
  • Seven kinds of variation, from wrapped headers to Excel serial dates.
  • A format change from PDF to Excel partway through the series.

Deliverable: Variability catalogue and target schema.

Design · One schema, many inputs

Every file, whatever its format, ends up in the same twelve columns.

  • Advice number, date, payer, bill month, licensee and UTR.
  • Billing, ratio, gross realisation, rebate, TDS and net disbursement.
  • A check that ratio × RTGS amount matches gross realisation.

Deliverable: Canonical schema and validation rules.

Build · Custom functions

Each kind of variation got its own small, reusable M function.

  • fxTransformDA reads one file and routes PDF or Excel.
  • fxCleanHeaders, fxParseINR, fxSplitRTGS, fxMapLicensee, fxFromExcel.
  • A folder query that applies them to every file and stacks the results.

Deliverable: Power Query workbook with six custom functions.

Adopt · Drop files, press Refresh

The finance team's whole routine became two actions.

  • Save new advices into the batch folder.
  • Refresh: every file is read, cleaned and checked.
  • Any row failing a check is listed with its source file name.

Deliverable: One-page guide and walkthrough.

Scale · Ready for the next format

A new variation means one new mapping or function, not a rebuild.

  • Licensee name map kept in an Excel table the team edits.
  • New folders picked up automatically.
  • Output feeds receivables, TDS and rebate reconciliations.

Deliverable: Maintenance notes and mapping tables.

The Solution

A custom Power Query process that reads every advice

Below are the original screens, then a step-by-step replay of what Power Query does to one advice, and finally the whole folder refreshing at once.

01 · The original screens

The query, the source advice and the batch folders

Shown as delivered. Click any screen to enlarge it. One folder name in the query path is pixelated.

Power Query Advanced Editor showing the folder query that invokes a Transform File custom function
The folder query. Folder.Files → filter hidden files → invoke the Transform File custom function → expand → set types for Payment Document, Posting Date, Customer Name, Bill Number, Bill Amount, Already Paid, RTGS Reference, RTGS Amount, TDS, Rebate, Total and Outstanding.
POWERGRID disbursement advice number 3687 with payment header and licensee-wise payment details
A source advice. Advice No. 3687 (02.08.2016): a payment header, then licensee-wise payment details with billing, disbursement ratio, gross realisation, rebate, TDS and net disbursement. Page 1 of 3.
Batch folders from DA 3011-3030 to DA 3974 to 4001, early ones with PDFs and later ones with Excel files
The batch folders. Batch folders from DA 3011–3030 to DA 3974–4001. Early batches hold PDFs; from DA 3563 most hold Excel files.
02 · Extraction lab

Watch one advice go from PDF to clean rows

Pick a format, then press play or step through. Pink marks dirty data; teal marks what the custom functions fixed. All three formats end in the same clean table.

Dirty / removedCleanedHeader row inside the data

Applied steps

    M code for this step

    Variability catalogue · click a card to replay that fix

    03 · Refresh the whole folder

    28 batches, one refresh

    Press Refresh to see the folder query work through every batch. The router sends PDFs and Excel files to the right function and logs each variation it handles.

    Format drift across the series

    PDF batchExcel batchMixedBar height = advices in the batch
    0Advices read
    0Clean rows
    0Variations handled
    0Rows failing checks
    ' Ready. Folder: DA 3011-4001 (28 batches)

    Batch names and formats follow the original folders (DA 3204–3330 is not visible in the screenshot and is assumed to be PDF). Row counts and logged variations are illustrative.

    Impact Dashboard

    Weeks of copy-paste became a five-minute refresh

    The team now spends its time on reconciliation exceptions instead of building the table they reconcile from.

    Advices consolidated vs hours of effort

    Building the full table from DA 3011 to DA 4001

    Data issues caught before reconciliation

    Share of each issue type fixed vs slipping through

    Caught and fixedSlipped through

    Figures indicative; validated metrics available on request.

    Before vs After

    How the advice data reaches the reconciliation

    DimensionBeforeAfter
    Getting the dataOpen each PDF, copy each tableFolder query reads every file
    Time for the full setAbout three weeksAbout five minutes per refresh
    Format changesTemplates broke; rework each timeCustom functions route and clean each format
    Numbers and namesMixed commas, zeros as "00000", name variantsParsed to numbers, mapped to one licensee list
    ChecksSpot checks at month endEvery row checked: ratio × RTGS = gross
    Audit trailHard to trace a figure to its fileEvery row carries its source file and advice number
    Tools & Tech Used

    All inside Excel

    Power Query Folder and PDF connectors M language six custom functions Excel output table and checks Mapping tables licensee names, maintained by finance Validation rules ratio × RTGS = gross realisation
    Key Takeaways

    What any finance team can borrow

    01

    Solve one file, then the folder

    Once Power Query can read one advice reliably, a thousand is just a refresh.

    02

    Name every variation

    A catalogue of the ways files differ became a set of small functions. Each new quirk is one more rule, not a rebuild.

    03

    Check as you load

    Validation built into the query means reconciliation starts from data the team already trusts.